package com.goktech.olala.core.service;

import com.github.pagehelper.PageInfo;
import com.goktech.olala.core.req.ReqOrder;
import com.goktech.olala.core.resp.OrderResp;
import com.goktech.olala.core.resp.RespOrderDetailVo;
import com.goktech.olala.server.pojo.order.OrderDetail;
import com.goktech.olala.server.pojo.order.OrderMaster;

import java.util.List;

/**
 * @author wyn
 */
public interface IOrderDetailService {
    /**
     * 根据id查询
     * @param id
     * @param goodsId
     * @return
     * @throws Exception
     */
    int selectById(Integer id, String goodsId)throws  Exception;

    /**
     * 删除
     * @param id
     * @return
     * @throws Exception
     */
    int deleteById(Integer id)throws Exception;

    /**
     * 根据id查询所有
     * @param orderId
     * @return
     * @throws Exception
     */
    List<OrderDetail> selectAllById(Integer orderId)throws Exception;

    /**
     * 更新订单
     * @param record
     * @return
     * @throws Exception
     */
    int updateOrderDetail(OrderDetail record)throws Exception;

    /**
     * 新增订单
     * @param record
     * @return
     * @throws Exception
     */
    int insertOrderDetail(OrderDetail record)throws  Exception;

    /**
     * 查询订单信息
     * @param pageIndex
     * @param pageSize
     * @param orderReq
     * @return
     * @throws Exception
     */
    PageInfo<OrderResp> queryOrders(int pageIndex, int pageSize, ReqOrder orderReq) throws Exception;

    /**
     * 根据id查询订单信息
     * @param orderId
     * @return
     * @throws Exception
     */
    OrderResp queryOrderById(Integer orderId) throws Exception;

    /**
     * 根据id修改订单信息
     * @param orderDetail
     * @return
     * @throws Exception
     */
    int updateByExample(OrderDetail orderDetail) throws Exception;

    /**
     * 根据id删除订单信息
     * @param orderDetailId
     * @return
     * @throws Exception
     */
    int removeOrderById(Integer orderDetailId) throws Exception;

    /**
     * 根据id查询订单主表信息
     * @param customerId
     * @return
     * @throws Exception
     */
    OrderMaster selectByCustomerId(String customerId) throws Exception;

    /**
     * 购物车信息插入订单主表
     * @param reqOrder
     * @return
     * @throws Exception
     */
    int saveOrder(ReqOrder reqOrder) throws Exception;

    /**
     * 查询订单信息和订单主表
     * @param customerId
     * @return
     * @throws Exception
     */
    List<RespOrderDetailVo> queryDetailAndMasterOrderById(String customerId) throws Exception;

}
